/* 
 * Parser plugin for GTF in BAT.
 * Copyright (C) 2006 Bob Zimmermann <rpz@cse.wustl.edu>
 *
 *  This file is a part of BAT.
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 * BAT_GTF_Parser.h
 *
 * Parser for BAT.
 *
 * $Id: BAT_GTF_Parser.h 1406 2006-09-20 20:27:36Z rpz $
 *
 */

#ifndef BAT_GTF_PARSER_H
#  define BAT_GTF_PARSER_H

#  include <ctype.h>
#  include <stdio.h>
#  include <stdlib.h>
#  include <libgen.h>
#  include "BAT_Annotation.h"
#  include "BAT_Factory.h"
#  include "BAT_Parser.h"
#  include "darray.h"

#  define BAT_GTF_LINE_SZ 1024

extern BAT_Parse_Plugin BAT_GTF_Parse_Plugins;
typedef struct _BAT_GTF_Parse_Context BAT_GTF_Parse_Context;

struct _BAT_GTF_Parse_Context
{
  int err;
  int lineno;
  int start;
  int pos;
  BAT_Free_Feature *feat;
  BAT_Attribute *gid_attr, *tid_attr, *attr;
  BAT_Comment *cmt;
  darray_t *feats;
  char line[BAT_GTF_LINE_SZ];
};

extern BAT_Parse_Plugin BAT_GTF_Parse_Plugin;

int BAT_GTF_can_parse (char *filename);
void *BAT_GTF_Parser_new ();
void BAT_GTF_Parser_delete (void *p, int);
BAT_Free_Feature **BAT_GTF_Parser_parse_file (void *p, FILE * fh, unsigned *n_feats);

#endif /* BAT_GTF_PARSER_H */
